package com.xckj.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xckj.dao.JacgMethodCallInfoMapper;
import com.xckj.entity.JacgMethodCallInfo;
import com.xckj.service.JacgMethodCallInfoService;
import com.xckj.utils.ReturnT;

/**
 * @description 方法调用信息表
 * @author yanchf
 * @date 2023-12-03
 */
@Service
public class JacgMethodCallInfoServiceImpl implements JacgMethodCallInfoService {

	@Resource
	private JacgMethodCallInfoMapper jacgMethodCallInfoMapper;


	@Override
	public Object insert(JacgMethodCallInfo jacgMethodCallInfo) {

		// valid
		if (jacgMethodCallInfo == null) {
			return ReturnT.error("必要参数缺失");
        }

		jacgMethodCallInfoMapper.insert(jacgMethodCallInfo);
        return ReturnT.success();
	}


	@Override
	public Object delete(int id) {
		int ret = jacgMethodCallInfoMapper.delete(id);
		return ret>0?ReturnT.success():ReturnT.error();
	}


	@Override
	public Object update(JacgMethodCallInfo jacgMethodCallInfo) {
		int ret = jacgMethodCallInfoMapper.update(jacgMethodCallInfo);
		return ret>0?ReturnT.success():ReturnT.error();
	}


	@Override
	public JacgMethodCallInfo load(int id) {
		return jacgMethodCallInfoMapper.load(id);
	}


	@Override
	public Map<String,Object> pageList(int offset, int pagesize) {

		List<JacgMethodCallInfo> pageList = jacgMethodCallInfoMapper.pageList(offset, pagesize);
		int totalCount = jacgMethodCallInfoMapper.pageListCount(offset, pagesize);

		// result
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("pageList", pageList);
		result.put("totalCount", totalCount);

		return result;
	}

}